package cn.qn.service.impl.sys;

import cn.qn.moudle.sys.City;
import cn.qn.repository.sys.CityRepository;
import cn.qn.service.sys.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: Bryant
 * @Date: 2018/6/11
 * @Description:
 */
@com.alibaba.dubbo.config.annotation.Service(interfaceClass = CityService.class)
@Service
public class CityServiceImpl implements CityService {

    @Autowired
    private CityRepository cityRepository;

    @Override
    public City findCityByCode(String code) {
        return cityRepository.findCityByCode(code);
    }

    @Override
    public List<City> list(String provinceCode) {
        return cityRepository.findByProvinceCode(provinceCode);
    }

    @Override
    public List<City> findAllCitys() {
        return cityRepository.findAll();
    }

    @Override
    public City findCityByName(String cityName) {
        return cityRepository.findCityByNameContaining(cityName);
    }
}
